let tabBox = document.getElementById('tabBox');
let tabList = tabBox.getElementsByTagName('div');
let navBox = document.getElementById('navBox');
let navList = navBox.getElementsByTagName('li');

/* for(var i = 0; i < navList.length; i++) {
  navList[i].myIndex = i;
  navList[i].onclick = function() {
    changeTab(this.myIndex);
  }
} */
for(var i = 0; i < navList.length; i++) {
  navList[i].onclick = (function(i) {
    return function() {
      changeTab(i);
    }
  })(i);
}

function changeTab(tabIndex) {
  for(let i = 0; i < navList.length; i++) {
    navList[i].className = '';
    tabList[i].className = '';
  }
  navList[tabIndex].className = 'active';
  tabList[tabIndex].className = 'active';
}
